from tortoise import BaseDBAsyncClient


async def upgrade(db: BaseDBAsyncClient) -> str:
    return """
        CREATE TABLE IF NOT EXISTS `participate_jobs` (
    `id` INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `job_id` INT NOT NULL COMMENT '关联工作',
    `user_id` INT NOT NULL COMMENT '关联用户',
    CONSTRAINT `fk_particip_jobs_bd86415b` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) ON DELETE CASCADE,
    CONSTRAINT `fk_particip_user_e9e4e384` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE
) CHARACTER SET utf8mb4 COMMENT='用户参与工作关联表';"""


async def downgrade(db: BaseDBAsyncClient) -> str:
    return """
        DROP TABLE IF EXISTS `participate_jobs`;"""
